<template>
	<div>
		<el-table :data="tableData" :show-header="false">
			<el-table-column prop="type" width="140">
			</el-table-column>
			<el-table-column prop="money" width="120">
			</el-table-column>
			<el-table-column prop="name">
			</el-table-column>
			<el-table-column prop="date">
			</el-table-column>
		</el-table>
	</div>
</template>

<script>
	export default {
			data() {
				return {
					tableData:[]
				}
			},
			created() {
				// 充值
				this.$axios({
				  method: "get",
				  url: "/Rec/findRec",
				  headers: { "Content-Type": "application/json"},
				}).then((res) => {
					for(let i in res.data.data){
						this.tableData.push({"type":"充值","date":res.data.data[i]["createTime"],"money":res.data.data[i]["money"]+"元","name":res.data.data[i]["payMethod"]})
					}
				  }).catch((e) => {
				    console.log(e);
				  });
				  
				  // 消费
				  this.$axios({
				    method: "get",
				    url: "/Cons/findCons",
				    headers: { "Content-Type": "application/json"},
				  }).then((res) => {
				  	for(let i in res.data.data){
				  		this.tableData.push({"type":"消费","date":res.data.data[i]["createTime"],"money":res.data.data[i]["money"]+"元","name":res.data.data[i]["consDemo"]})
				  	}
				    }).catch((e) => {
				      console.log(e);
				    });
			}
		};
</script>

<style>
</style>
